Repository navigation
Restrict BV sharing to bit-vector applications - #11851
Nikolaj Bjorner (NikolajBjorner) wants to merge 2 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
F* NFV audit: provedAudited head: Partial scope: one changed function (BV family guard in maximize_bv_sharing::reduce_app), 3 obligations proved on a guard-level model; C++ execution not verified. Pre-PR witness (bool or / arith + collide on kind 6) confirmed and removed by the guard. Download the audit sources, report, and log from the run artifacts; no branch writes were attempted. F* modelmodule BvSharingFamilyGuard
(* Model of maximize_ac_sharing::reduce_app guards (maximize_ac_sharing.cpp:30-38)
and the PR's maximize_bv_sharing::reduce_app family guard (header :110-114).
Family ids: only distinctness matters. Kind values computed from the enums at base. *)
type family = | Basic | Arith | BV
type decl = { fam: family; kind: nat; assoc: bool }
let registered (k:nat) : bool = k = 4 || k = 6 || k = 31 || k = 30 // OP_BADD,OP_BMUL,OP_BOR,OP_BAND
(* base: reduce_app proceeds past guards iff associative, n>2, kind registered *)
let base_rewrites (d:decl) (n:nat) : bool = d.assoc && n > 2 && registered d.kind
(* head: additionally requires BV family *)
let head_rewrites (d:decl) (n:nat) : bool = d.fam = BV && base_rewrites d n
let bool_or : decl = { fam = Basic; kind = 6; assoc = true } // OP_OR = 6
let arith_add: decl = { fam = Arith; kind = 6; assoc = true } // arith OP_ADD = 6
(* O1: witnesses at base: Boolean or / arithmetic + with 3 args are rewritten *)
let o1a () : Lemma (base_rewrites bool_or 3 = true) = ()
let o1b () : Lemma (base_rewrites arith_add 3 = true) = ()
(* O2: at head they are not *)
let o2 () : Lemma (head_rewrites bool_or 3 = false /\ head_rewrites arith_add 3 = false) = ()
(* O3: head never rewrites non-BV; and for BV decls head agrees with base *)
let o3 (d:decl) (n:nat) : Lemma
(ensures (d.fam <> BV ==> head_rewrites d n = false) /\ (d.fam = BV ==> head_rewrites d n = base_rewrites d n)) = ()
This is a scoped semantic source audit, not mechanized verification of the C++ implementation or the entire PR. Generated by Fstar NFV PR audit. |
Determinism warningsWarnings in affected files (base 102/1101, PR 102/1101 translation units). Base: 27 → PR: 27; change: +0. Base
Warning diffNo warning changes. |
The BV-sharing pass matched operator kinds without checking their family. Kind collisions caused it to rebalance Boolean
orand arithmetic+applications, affecting solver stability.